package com.meichis.yndms.room.converter;


import androidx.collection.ArrayMap;
import androidx.room.TypeConverter;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

public class MapConverter {

    //ArrayMap<String, Integer>
    @TypeConverter
    public static ArrayMap<String, Integer> strAM(String json) {
        return new Gson().fromJson(json, new TypeToken<ArrayMap<String, Integer>>() {
        }.getType());
    }

    @TypeConverter
    public static String aM2Str(ArrayMap<String, Integer> map) {
        return new Gson().toJson(map);
    }
}
